package com.ari.order;

import com.alibaba.cloud.nacos.ribbon.NacosRule;
import com.ari.feign.client.UserClient;
import com.netflix.loadbalancer.IRule;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
//@EnableFeignClients(basePackages = "com.ari.feign.client")
@EnableFeignClients(clients = UserClient.class)
public class OrderApplication {
    public static void main(String[] args) {
        SpringApplication.run(OrderApplication.class,args);
    }

    @Bean
    @LoadBalanced
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

/*    @Bean//eureka
    public IRule randomRule(){
        //默认为轮询规则，这里自定义为随机规则
        return new RandomRule();
    }*/
    @Bean//alibaba
    public IRule iRule(){
        //默认为轮询规则，这里自定义为随机规则
        return new NacosRule();
    }

}